<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!-- 引入jstl -->
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="header.jsp"%>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%-- ${list} --%>
	<table class="table table-striped table-bordered table-hover table-condensed">
		<tr>
			<td>ID</td>
			<td>名字</td>
			<td>密码</td>
			<td>年龄</td>
			<td>邮箱</td>
			<td>删除</td>
		</tr>
		<c:forEach items="${pageInfo.list}" var="user">
			<tr>
				<td>${user.id}</td>
				<td>${user.name}</td>
				<td>${user.password}</td>
				<td>${user.email}</td>
				<td>${user.age}</td>
				<td><a href="javascript:deleteById(${user.id})">删除</a></td>
			</tr>
		</c:forEach>
	</table>
	<nav aria-label="Page navigation">
	  <ul class="pagination">
	    <li>
	      <a href="#" aria-label="Previous">
	        <span aria-hidden="true">&laquo;</span>
	      </a>
	    </li>
	    <c:forEach begin="1" end="${pageInfo.totalPage}" var="i">
		    <li><a href="${path}/user?method=selectByPage&pageNo=${i}">${i}</a></li>
	    </c:forEach>
	    
	    <li>
	      <a href="#" aria-label="Next">
	        <span aria-hidden="true">&raquo;</span>
	      </a>
	    </li>
	  </ul>
	</nav>
	
	<script type="text/javascript">
		function deleteById(id) {
			var isDelete = confirm('您确定要删除么?');
			if(isDelete) {
				location.href = '${path}/user?method=deleteById&id=' + id;
			}
		}
	</script>
</body>
</html>